package com.example.demospring.business.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demospring.business.entity.ImgSave;
import com.example.demospring.business.mapper.ImgsMapper;
import com.example.demospring.common.entity.Message;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


@Service
public class ImgsServer extends ServiceImpl<ImgsMapper, ImgSave> {

    // 查询整张表
    public List<ImgSave> showImgs(){
        return baseMapper.selectList(null);
    }

    public List<ImgSave> showImgsByDate(String date){
        return baseMapper.getImgByDate(date);
    }

    public Message addImg(ImgSave img){
        img.setImgDate(new Date());
        int result = baseMapper.addImg(img);
        return Message.succeed(result);
    }

}
